#include <stdio.h>
int jiaxu(int a,int b[]){
	while(a>9){
		b[a%10]++;
		a = a/10;
	}b[a]++;
}

int main(){
	int i,n,max;
	scanf("%d",&n);
	int a[n];int b[10] = {0};
	for(i = 0;i<n;i++){
		scanf("%d",&a[i]);
	}for(i = 0;i<n;i++){
		//jiaxu(a[i],b);
		while(a[i]>9){
			b[a[i]%10]++;
			a[i] = a[i]/10; 
		}b[a[i]]++;
		{
			for(int j = 0;j<10;j++){
				printf("%d",b[j]);
			}printf("\n");
		} 
	}max = -1;
	for(i = 0;i<10;i++){
		if(b[i]>max){
			max = b[i];
		}
		{
			printf("%3d",max);
		}
	}printf("%d:",max);
	for(i = 0;i<10;i++){
		if(b[i]==max){
			printf(" %d",i);
		}
	}return 0;
}
